home *** CD-ROM | disk | FTP | other *** search
/ Aminet 19 / Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso / Aminet / comm / misc / RecentScript.lha / RecentScript / Configs / AmFTP ARexx.intro < prev    next >
Encoding:
Text File  |  1997-04-04  |  1.2 KB  |  75 lines

  1. /* ARexx - Download script for AmFTP
  2.  *
  3.  * Script generated by RecentScript
  4. */
  5.  
  6. OPTIONS RESULTS
  7.  
  8. IF ~SHOW('l', "rexxsupport.library") THEN DO
  9.   CALL ADDLIB('rexxsupport.library',0,-30,0)
  10. END
  11.  
  12. SAY "Search running and idle AMFTP..."
  13.  
  14. oldport = ""
  15. newport = ""
  16.  
  17. DO i=1 TO 5
  18.   port = "AMFTP."i
  19.   IF SHOW(PORTS,port) = 1 THEN DO
  20.     ADDRESS value port
  21.     ISCONNECTED
  22.     connectstate = RESULT
  23.     IF connectstate = 1 THEN DO
  24.       SAY "AMFTP."i" is busy"
  25.     END
  26.     ELSE DO
  27.       SAY "AMFTP."i" is idle"
  28.       IF oldport = "" THEN oldport = port
  29.     END
  30.   END
  31.   ELSE DO
  32.     SAY "AMFTP."i" is not started"
  33.     IF newport = "" THEN newport = port
  34.   END
  35. END
  36.     
  37. IF oldport = "" THEN DO
  38.    SAY "Start new "newport"..."
  39.    ADDRESS COMMAND 'run <>NIL: "%3"'
  40.    DO 3 WHILE ~SHOW(PORTS,newport)
  41.      ADDRESS COMMAND 'WaitForPort 'newport
  42.    END
  43.    IF RC = 5 THEN DO
  44.      SAY "failed"
  45.      EXIT
  46.    END
  47.    SAY "succeded."
  48.    portname = newport
  49. END
  50. ELSE DO
  51.   portname = oldport
  52. END
  53.  
  54. SAY "Using "portname
  55.  
  56. resultport = "RSLT."portname
  57.  
  58. ADDRESS value portname
  59.  
  60. CALL OPENPORT(resultport)
  61.  
  62. SAY "Connecting %1..."
  63. CONNECTHOST "%1"
  64. WAITACTION resultport
  65. CALL WAITPKT resultport
  66.  
  67. ISCONNECTED
  68. connectstate = RESULT
  69. IF connectstate = 0 THEN DO
  70.   SAY "failed"
  71.   EXIT
  72. END
  73.  
  74. SAY "succeeded"
  75.